package cn.virens.common.service.dubbo.consumer;

import cn.virens.common.entity.BaseModel;
import cn.virens.common.entity.param.PageParam;
import cn.virens.common.entity.result.PageResult;
import cn.virens.common.exception.APIException;
import cn.virens.common.service.dubbo.BaseReadProvider;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

public abstract class BaseReadConsumerImpl<S extends BaseReadProvider<T>, T extends BaseModel> implements BaseReadProvider<T> {
    protected abstract S baseProvider();

    @Override
    public T selectOne(Serializable id) throws APIException {
        return baseProvider().selectOne(id);
    }

    @Override
    public PageResult<?> selectPage(PageParam pageParam) throws APIException {
        return baseProvider().selectPage(pageParam);
    }

    @Override
    public List<? extends T> selectAll(Map<String, Object> param) throws APIException {
        return baseProvider().selectAll(param);
    }

}
